package edu.cibertec.sicsolutions.vfs.dao.votacion.ibatis;
import edu.cibertec.sicsolutions.vfs.dao.votacion.ElectorVirtualDao;
import edu.cibertec.sicsolutions.vfs.domain.votacion.ElectorVirtual;
import edu.cibertec.sicsolutions.vfs.spring.SpringIbatisBase;
import edu.cibertec.sicsolutions.exception.DaoException;
import java.util.List;
import java.util.Map;

/**
 * Data Access Object Implementation of table ELECTOR_VIRTUAL 
 * @author enrique.vargas
 *
 */
public class ElectorVirtualDaoImpl extends SpringIbatisBase implements ElectorVirtualDao {	

	public ElectorVirtual getElectorVirtualByPk(ElectorVirtual electorVirtual) throws DaoException{
		try{
			return (ElectorVirtual)queryForObject("getElectorVirtualByPk", electorVirtual);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}		
	}
	
	public void insertElectorVirtual(ElectorVirtual electorVirtual) throws DaoException{
		try{
			insert("insertElectorVirtual", electorVirtual);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}		
	}
	
	public void updateElectorVirtual(ElectorVirtual electorVirtual) throws DaoException{		
		try{
			update("updateElectorVirtual", electorVirtual);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
	
	public void updateElectorVirtualByMap(Map map) throws DaoException{		
		try{
			update("updateElectorVirtualByMap", map);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
	
	public void deleteElectorVirtualByPk(ElectorVirtual electorVirtual) throws DaoException{		
		try{
			delete("deleteElectorVirtualByPk", electorVirtual);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
	
	public ElectorVirtual[] findElectorVirtualByClass(ElectorVirtual electorVirtual) throws DaoException{
		try{
			List list = queryForList("findElectorVirtualByClass", electorVirtual);
			return (ElectorVirtual[])list.toArray(new ElectorVirtual[list.size()]);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
}